//
//  popContentViewController.m
//  HondaPro_2
//
//  Created by glendale on 13-7-22.
//  Copyright (c) 2013年 glendale. All rights reserved.
//

#import "popContentViewController.h"

@interface popContentViewController ()

@end

@implementation popContentViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 40;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [self.list count];
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
        cell.textLabel.font = [UIFont systemFontOfSize:17];
        
        cell.textLabel.textAlignment = UIBaselineAdjustmentAlignCenters;
    }
    cell.textLabel.text =[self.list objectAtIndex:indexPath.row];
    cell.textLabel.textColor = [UIColor grayColor];
    
    UIView * v = [[UIView alloc] init];
    v.backgroundColor = [UIColor grayColor];
    cell.selectedBackgroundView = v;
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    UITableViewCell *c = [tableView cellForRowAtIndexPath:indexPath];
    [self.btnSender setTitle:c.textLabel.text forState:UIControlStateNormal];
    if ([_delegate respondsToSelector:@selector(popContentViewController:name:code:)]) {
        [_delegate popContentViewController:self name:c.textLabel.text code:self.codeAry[indexPath.row]];
    }
    [self.delegate selectDelegate:[indexPath row] btn:self.btnSender];
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
